package com.douma.practical_3.external_sort;


import java.io.BufferedWriter;
import java.io.IOException;
import java.util.Random;

/**
 * 准备阶段：准备 1000 万个整数
 * 数据写道当前工程目录下的文件：data\sort\nums.txt
 */
public class _0_NumGenerator {
    private static Random r = new Random();

    public static void main(String[] args) throws IOException {

        BufferedWriter writer = FileIOUtils.getWriter("data\\sort\\nums.txt");

        // 随机写 1000 万 个 0 ~ 10000000 个整数到文件中
        for (int i = 0; i < 10000000; i++) {
            int num = r.nextInt(10000000);
            writer.write(String.valueOf(num));
            writer.newLine();
        }

        FileIOUtils.closeWriter(writer);
    }
}
